from flask import Flask, jsonify
from data import transactions, courses, venues

app = Flask(__name__)


@app.route('/')
def hello_world():  # put application's code here
    return 'Hello World!'

# 获取实时成交数据
@app.route("/api/transactions", methods=["GET"])
def get_transactions():
    return jsonify({
        "code": 0,
        "msg": "操作成功",
        "data": transactions
    })

# 获取精选课程
@app.route("/api/courses", methods=["GET"])
def get_courses():
    return jsonify({
        "code": 0,
        "msg": "操作成功",
        "data": courses
    })

# 获取推荐场馆
@app.route("/api/venues", methods=["GET"])
def get_venues():
    return jsonify({
        "code": 0,
        "msg": "操作成功",
        "data": venues
    })

if __name__ == '__main__':
    app.run()
